<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>切换图片</title>
</head>
<body>
    <script src="vue.js"></script>
    <div id="app">
        <img :src="image" id="img" >
        <button @click="click" type="button">点我切换图片</button>
    </div>
</body>
<script>
    var app = new Vue({
        el:"#app",
        data:{
            image:'img/2013.jpg',
        },
        methods:{
            click(){
                if(this.image=="img/2013.jpg")
                {
                    this.image="img/2017.jpg";
                    console.log("1")
                }else{
                    this.image="img/2013.jpg";
                    console.log("2")
                }
                        
            },
            
        },
    });
        
</script>
</html>